<?php
function lunarCalendar(int $year, int $month):void{
    $dateStr = "{$year}-{$month}-01";
    $d = new DateTime($dateStr);
    $firstDayWeek = (int)$d->format('N') - 1;
    $totalDays = (int)$d->format('t');
    echo "    {$year}年{$month}月\n";
    echo "一 二 三 四 五 六 日\n";
    for ($i = 0; $i < $firstDayWeek; $i++) {
        echo "   ";
    }
    for ($day = 1; $day <= $totalDays; $day++) {
        echo str_pad($day, 2, ' ', STR_PAD_LEFT) . ' ';
        if (($firstDayWeek + $day) % 7 == 0) {
            echo "\n";
        }
    }
    echo "\n";
}
lunarCalendar(2025, 10);
